package com.bootemp.common;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class MyAop {
    //日志对象
    public static Logger log= LoggerFactory.getLogger(MyAop.class);
    /**
     * 设置目标类
     */
    @Pointcut(value = "execution(* com..service.*.*(..))")
    public void test(){

    }
    @Before(value = "test()")
    public  void before(JoinPoint point){

        System.out.println(point.getSignature().getName()+"将要执行");
        //写入日志
        log.info(point.getSignature().getName()+"将要执行");
    }
}
